{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "qrFgAbcD3B5x"
      },
      "source": [
        "# Example Evaluation (Inference) of TGT on the PCQM4Mv2 Dataset"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "nmicdlIt9Pds"
      },
      "source": [
        "## Clone the repositiory"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "apWACmEsxGeS"
      },
      "outputs": [],
      "source": [
        "!git clone https://github.com/shamim-hussain/tgt.git\n",
        "%cd tgt"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "4qBw91P69TuS"
      },
      "source": [
        "## Download the data\n",
        "(Alternatively you can download them manually)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "KWhrDHfzy5HB"
      },
      "outputs": [],
      "source": [
        "!bash download_data.sh"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "6aqf-OiD9cf9"
      },
      "source": [
        "## Download the model weights\n",
        "(Alternatively download them manually and put them in the models directory keeping the directory structure)\n",
        "\n",
        "Make sure `huggingface_hub` is installed or install it with\n",
        "\n",
        "\n",
        "```\n",
        "pip install huggingface_hub\n",
        "```\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "RhiYtr6kzNid"
      },
      "outputs": [],
      "source": [
        "!huggingface-cli download --local-dir . --local-dir-use-symlinks False --include 'models/pcqm/tgt_at_200m/*' -- shamim-hussain/tgt"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Kkz8qhtv97Jb"
      },
      "source": [
        "## Make distance predictions on the validation set"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "_LSMCO5tz-fT"
      },
      "outputs": [],
      "source": [
        "!python make_predictions.py configs/pcqm/tgt_at_200m/dist_pred/tgt_at_dp_rdkit.yaml 'predict_on: [\"val\"]'"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "fCHoERpC9_D0"
      },
      "source": [
        "## Predict and evaluate the energy gaps on the validaiton set"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "VRMxXuj1-EJY"
      },
      "outputs": [],
      "source": [
        "!python do_evaluations.py configs/pcqm/tgt_at_200m/gap_pred/tgt_at_tp_rdkit.yaml 'predict_on: [\"val\"]'"
      ]
    }
  ],
  "metadata": {
    "accelerator": "GPU",
    "colab": {
      "gpuType": "T4",
      "provenance": []
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}
